<template>
  <a-card :bordered="false">
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :md="6" :sm="8">
            <a-form-item label="责任单位">
              <j-select-depart
                v-model="queryParam.bsjdw"
                :trigger-change="true"
                customReturnField="id"
                :multi="false"
              ></j-select-depart>
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
            <a-form-item label="是否通过审核">
              <j-dict-select-tag
                style='width: 100%'
                placeholder="请选择"
                v-model="queryParam.sftgsh"
                dict-code="yes_no" />
            </a-form-item>
          </a-col>
          <template v-if="toggleSearchStatus">
            <a-col :md="6" :sm="8">
              <a-form-item label="审计项目名称">
                <a-input placeholder="请输入" v-model="queryParam.proName"></a-input>
              </a-form-item>
            </a-col>
            <a-col :md="6" :sm="8">
              <a-form-item label="审计报告名称">
                <a-input placeholder="请输入" v-model="queryParam.sjbgmc"></a-input>
              </a-form-item>
            </a-col>
            <a-col :md="6" :sm="8">
              <a-form-item label="内容">
                <a-input placeholder="请输入" v-model="queryParam.contents"></a-input>
              </a-form-item>
            </a-col>
          </template>
          <a-col :md="6" :sm="8">
            <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" style="margin-left: 8px" icon="reload">清除条件</a-button>
              <a-button type="primary" style="margin-left: 8px" icon="download" @click="OnExportList">导出</a-button>
              <a @click="handleToggleSearch" style="margin-left: 8px">
                {{ toggleSearchStatus ? '收起' : '展开' }}
                <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
              </a>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>

    <!-- 操作按钮区域 -->

    <!-- table区域-begin -->
    <div>
      <a-table
        ref="table"
        rowKey="id"
        size="middle"
        bordered
        width="100vw"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :scroll="{ x: 250, y: 520 }"
        @change="handleTableChange"
      >
        <template v-for="itemNormal in normalCell" v-slot:[itemNormal]="text, record">
          <div :title="record[itemNormal]" style="width: 100%; height: 45px; overflow-x: hidden; overflow-y: auto">{{ record[itemNormal] }}</div>
        </template>
        <template slot="sftgsh" slot-scope="text, record">
          <a-switch
            checked-children="是"
            un-checked-children="否"
            :disabled="true"
            :checked="text=='1'"
          />
        </template>
      </a-table>
    </div>
  </a-card>
</template>

<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import columns from './indexColumns'
import 'moment/locale/zh-cn'
import { mapGetters } from 'vuex'
import { getAction } from '@api/manage'

export default {
  name: 'zgtjfx',
  mixins: [JeecgListMixin],
  data() {
    return {
      queryParam: {},
      superParam: {
        userId: this.userInfo().id,
        stage: '040'
      },
      // 表头
      columns: columns(this),
      url: {
        list: '/sjxmzygl/sjListRectification/list',
        issued: '/sjxmzygl/sjListRectification/issued',
        exportList: '/sjxmzygl/sjListRectification/exportRectificationList'
      },
      yearPickShow: false,
      normalCell: [
        'proName',
        'sjbgmc',
        'bgwh',
        'bgdygx',
        'bsjdwName',
        'wtnr',
        'dingxing',
        'dxyj',
        'zrjd',
        'zgjy',
        'wzjy',
        'zgdbbm',
        'xjdw',
        'zgcssxzg',
        'zgcsjyfszg',
        'zgcsytzg',
        'zgztzgzt',
        'zgztzgyy',
        'zgztxybzgcs',
        'wzclzzwzwjh',
        'wzclzzwzwjmc',
        'zczlmc',
        'shryj',
        'bz',
        'shryj'
      ]
    }
  },
  created() {
  },
  computed: {},
  methods: {
    ...mapGetters(['userInfo']),

    updateProList() {
      this.searchQuery()
    },

    OnExportList() {
      getAction(this.url.exportList, this.getQueryParams()).then((res) => {
        if (res.success && res.result) {
          this.$message.success('正在下载，请稍等！')
          const url = `${window._CONFIG['domianURL']}/sys/common/static${res.result}`
          window.open(url, '_blank')
        } else {
        }
      })
    }
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>